/*
 * worktask.h
 *
 *  Created on: 2012-5-2
 *      Author: epmm
 */

#ifndef WORKTASK_H_
#define WORKTASK_H_

class CWorkTask
{
	bool m_Block;
	u_int MAXJOBS;
	std::deque<CJobBase*> m_Jobs;

	CThreadMutex m_JobMutex;
	sem_t m_JobSem;
	sem_t m_JobFullSem;
public:
	CWorkTask();
	CWorkTask(bool block, int max_queue);
	virtual ~CWorkTask();

	int addJob(CJobBase* pJob);
	CJobBase* getJob();

	void SetBlockMode(bool Block);
	void SetMaxTaskSize(int size);

};

#endif /* WORKTASK_H_ */
